// pages/refunddetail/refunddetail.js

var t = getApp(), e = t.requirejs("core"), a = t.requirejs("biz/order");


Page({

    /**
     * 页面的初始数据
     */
    data: {

    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(e) {
        console.log(e, 'options');
        this.setData({
            options: e
        }), t.url(e), this.get_list(), this.get_list_two();
    },
    get_list: function() {
        var a = this;
        e.get("order/detail", a.data.options, function(e) {
            if (e.error > 0 && (5e4 != e.error && e.toast(e.message, "loading"), wx.redirectTo({
                url: "/pages/order/index"
            })), void 0 != e.nogift[0].fullbackgoods) var i = e.nogift[0].fullbackgoods.fullbackratio, o = e.nogift[0].fullbackgoods.maxallfullbackallratio, i = Math.round(i), o = Math.round(o);
            if (0 == e.error) {
                e.show = !0;
                var r = Array.isArray(e.ordervirtual);
                a.setData(e), a.setData({
                    ordervirtualtype: r,
                    fullbackgoods: e.nogift[0].fullbackgoods,
                    maxallfullbackallratio: o,
                    fullbackratio: i,
                    invoice: e.order.invoicename,
                    membercard_info: e.membercard_info
                });
            }
        });
    },
    get_list_two: function() {
        var t = this;
        e.get("order/refund", t.data.options, function(a) {
            console.log(a, 'aaaaaaaaaaaa');
            a.reasonIndex = null;

            t.setData({
                show: !0
            }), 0 == a.error ? (a.order.status < 2 && (a.rtypeArr = [ "退款(仅退款不退货)" ]), t.setData(a)) : (e.toast(a.message, "loading"),
            setTimeout(function() {
                wx.navigateBack();
            }, 1500));
        });
    },
    refundcancel: function(t) {
        a.refundcancel(this.data.options.id, function() {
            wx.navigateBack();
        });
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function() {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function() {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function() {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function() {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function() {

    }
})